import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'

// 全局配置
import './assets/global.css'
import './assets/fonts/iconfont.css'

// 导入axios
import axios from 'axios'

// 配置全局请求的根路径
axios.defaults.baseURL = 'http://39.103.175.135:8888/api/private/v1/'

// axios请求拦截
axios.interceptors.request.use(config => {
  // console.log(config)
  // 为请求头对象，添加token验证的Authorization字段
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

// 给vue原型添加一个属性￥http为axios对象
Vue.prototype.$http = axios
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
